<?php 
 /*-- Project Introduce --*/ 


abstract class JCAT_JPDRCommander
{
	/**
	 * Description
	 *
	 * @access	public
	 * @param	$aCOM 	COM
	 * @return	void
	 */
	public function JCAT_JPDRCommander(COM $aCOM)
	{
		$this->aCOM = $aCOM ;
	}
	
	
	/**
	 * Description
	 *
	 * @access	public
	 * @static
	 * @return	bool
	 */
	static public function CheckActiveX($sName)
	{
		try{
			$a = new COM($sName) ;
			$a = null ;
			
			return true ;		
		}
		catch (Exception $e)
		{$e ;
			return false ;
		}
	}
	
	/**
	 * Description
	 *
	 * @access	public
	 * @param	$Parameter
	 * @static
	 * @return	void
	 */
	static public function SetupActiveX($sCOMPath)
	{
		if( !is_file($sCOMPath) )
		{
			return ;
		}
		
		`regsvr32.exe /s "{$sCOMPath}"` ;
	}
	
	
	/**
	 * Description
	 *
	 * @access	public
	 * @return	void
	 */
	public function __destruct()
	{
		$this->aCOM = null ;
	}
	
	/**
	 * Description
	 *
	 * @access	public
	 * @return	bool
	 */
	public function IsAvailable()
	{
		return $this->aCOM? true: false ;
	}
	
	/**
	 * Description
	 *
	 * @access	protected
	 * @param	$Parameter
	 * @return	void
	 */
	protected function CheckAvailable()
	{
		if(!$this->IsAvailable())
		{
			throw new JCAT_Exception( JCAT_Language::SentenceEx('JPDR Commander 未能初始化','JCAT',null) ) ;
		}
	}
	
	/**
	 * Description
	 *
	 * @access	public
	 * @return	COM
	 */
	public function GetCOM()
	{
		return $this->aCOM ;
	}
	
	/**
	 * Description
	 * 
	 * @access	private
	 * @var		COM
	 */
	private $aCOM ;
	
}

?>